<template>
	<view>
		<articlelist :list="articleList" v-if="articleList.length!=0"></articlelist>
		<view class="" v-else>
			{{msg}}
		</view>
	</view>
</template>

<script>
	import kw from '../../apis/search/index.js';
	import {
		ref,
		toRefs,
		reactive,
		onMounted
	} from 'vue';
	export default {
		setup(props) {

			const articleList = ref([]);
			const msg = ref("")

			onMounted(function() {
				console.log(props.kw);

				kw.search({
					key_word: props.kw,
					skip: 0,
					limit: 100
				}).then(res => {
					articleList.value = res.data.data;
					if (articleList.value.length == 0)
						msg.value = "暂无搜索结果..."
				})

			})

			return {
				onMounted,
				articleList,
				msg
			}

		}
	}
</script>

<style scoped>

</style>
